package org.apache.jsp;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import com.asiainfo.ysrman.doprocess.*;
import com.asiainfo.ysrman.Beans.*;

public final class p_005fgoRingUrl_jsp extends org.apache.jasper.runtime.HttpJspBase
    implements org.apache.jasper.runtime.JspSourceDependent {

  private static java.util.Vector _jspx_dependants;

  static {
    _jspx_dependants = new java.util.Vector(1);
    _jspx_dependants.add("/webvalidate.jsp");
  }

  public java.util.List getDependants() {
    return _jspx_dependants;
  }

  public void _jspService(HttpServletRequest request, HttpServletResponse response)
        throws java.io.IOException, ServletException {

    JspFactory _jspxFactory = null;
    PageContext pageContext = null;
    HttpSession session = null;
    ServletContext application = null;
    ServletConfig config = null;
    JspWriter out = null;
    Object page = this;
    JspWriter _jspx_out = null;
    PageContext _jspx_page_context = null;


    try {
      _jspxFactory = JspFactory.getDefaultFactory();
      response.setContentType("text/html; charset=GBK");
      pageContext = _jspxFactory.getPageContext(this, request, response,
      			null, true, 8192, true);
      _jspx_page_context = pageContext;
      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      session = pageContext.getSession();
      out = pageContext.getOut();
      _jspx_out = out;

      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write('\r');
      out.write('\n');
	
	//??????
	if (session.getAttribute("mobile") == null||session.getAttribute("mobile").equals(""))
	{	
		//response.sendRedirect("index.jsp");
		out.println("<script language=\"javaScript\">parent.document.frames.top.window.location.href='p_login.jsp';</script>");
		return;
	}

      out.write('\r');
      out.write('\n');
	
	
	if (session.getAttribute("mobile") == null||session.getAttribute("mobile").equals(""))
	{	
		//response.sendRedirect("index.jsp");
		out.println("<script language=\"javaScript\">alert('请您先登陆再下载铃声,谢谢!');</script>");
		return;
	}
	else
	{
		String mobile = session.getAttribute("mobile").toString();
		int type = 0;
		
		if (mobile.substring(0,3).equals("133"))
			type = 1;//cdma code
		String aStr = request.getParameter("code");
		
		int aid = 0;
		if (aStr != null && !aStr.equals(""))
			aid = Integer.parseInt(aStr);
		String numStr =  request.getParameter("ringnum");
		
		int numid = 0;
		if (numStr != null && !numStr.equals(""))
			numid = Integer.parseInt(numStr);
		
		YsrProcess uiProcess = new YsrProcess();	
		WebUser wuser = new WebUser();
		wuser = uiProcess.getRingInfo(aid,numid,type);
		
		if (wuser != null )
		{
			if ( wuser.getRingUrl()!=null && !wuser.getRingUrl().equals(""))
			{			
				response.sendRedirect(wuser.getRingUrl());
			}
			else
				out.println("该地区运营商尚未开通此业务！");
		}
		else
			out.println("该地区运营商尚未开通此业务！");
		
	}


      out.write("\r\n");
      out.write("<html>\r\n");
      out.write("<head><title>网络地址</title></head>\r\n");
      out.write("<body></body>\r\n");
      out.write("</html>");
    } catch (Throwable t) {
      if (!(t instanceof SkipPageException)){
        out = _jspx_out;
        if (out != null && out.getBufferSize() != 0)
          out.clearBuffer();
        if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
      }
    } finally {
      if (_jspxFactory != null) _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }
}
